/**
 * Created by luomingzhong on 17/3/18.
 * 下面是一个使用栈的解决的问题
 * 如利用栈将一个数字从一种数制转换成另一种数制
 * 假设我们十进制数字n 转换为以b为基数的数字
 */

const Stack = require('../utils/Stack.class.js');

function mulBase(num, base) {
    let s = new Stack();
    do {
        s.push(num % base);
        num = Math.floor(num /= base);
    } while (num > 0);
    let converted = '';
    while (s.length() > 0) {
        converted += s.pop();
    }
    return converted;
}

var three = mulBase(34343434343433333333333232, 2);
console.log(three);